This document is adapted from the Bar Charts section of the Altair Example Gallery.

Our first step is to set up our environment:

Anscombe’s Quartet

Altair example

Chart

Becker’s Barley Trellis Plot

Altair example

Chart

Binned Scatterplot

Altair example

Chart

Bubble Plot

Altair example

Chart

Connected Scatterplot (Lines with Custom Paths)

Altair example

This example shows how layering can be used to build a plot. This dataset tracks miles driven per capita along with gas prices annually from 1956 to 2010. It is based on the May 2, 2010 New York Times article ‘Driving Shifts Into Reverse’. See this reference.

Chart

Dot Dash Plot

Altair example

This example shows how to make a dot-dash plot presented in Edward Tufte’s book Visual Display of Quantitative Information on page 133. This example is based on g3o2’s block.

Chart

Gapminder Bubble Plot

Altair example

This example shows how to make a bubble plot showing the correlation between health and income for 187 countries in the world (modified from an example in Lisa Charlotte Rost’s blog post ‘One Chart, Twelve Charting Libraries’).

Chart

Multifeature Scatter Plot

Altair example

Chart

Natural Disasters

Altair example

Chart

Polynomial Fit Plot

Altair example

Chart

Scatter Matrix

Altair example

Chart

Simple Scatter Plot with Labels

Altair example

Layering can now work with the + operator as it does in Python. Additionally, it can be declared as alt$layer(chart1, chart2) or as alt$ChartLayer(layer = list(chart1, chart2))

Chart

Table Bubble Plot (Github Punch Card)

Altair example

Chart

Trellis Scatter Plot

Altair example

This example demonstrates the need for a ggplot2::facet_wrap()-like capability, which we understand is coming to Vega-Lite in the no-so-distant future.

Chart